package com.bestcem.xm.ticket.grpc.client.enums.survey;

import lombok.Getter;

/**
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/31 14:41
 */
@Getter
public enum RespondentExtraSimilarStatusEnum {
    /**
     * 有雷同
     */
    RESPONDENTEXTRA_SIMILAR_STATUS_YES("有雷同", 0),

    /**
     * 无雷同
     */
    RESPONDENTEXTRA_SIMILAR_STATUS_NO("无雷同", 1);

    private final String name;
    private final Integer index;

    RespondentExtraSimilarStatusEnum(String name, Integer index) {
        this.name = name;
        this.index = index;
    }

    /**
     * 根据 index 获取枚举实体
     * 找不到则返回 null
     *
     * @param index 枚举index
     * @author zq.ding <zq.ding@idiaoyan.com>
     * @date 2021/8/31 13:35
     */
    public static RespondentExtraSimilarStatusEnum getByIndex(Integer index) {
        for (RespondentExtraSimilarStatusEnum value : values()) {
            if (value.getIndex().equals(index)) {
                return value;
            }
        }
        return null;
    }
}
